package Solution;
//
///**
// * Created with IntelliJ IDEA.
// * Description:
// * User: ws
// * Date: 2023-01-20
// * Time: 21:31
// */
//
///**
// * Forward declaration of guess API.
// *
// * @param num your guess
// * @return -1 if num is higher than the picked number
// * 1 if num is lower than the picked number
// * otherwise return 0
// * int guess(int num);
// */
//
//
////https://leetcode.cn/problems/guess-number-higher-or-lower/submissions/396493554/
//public class Solution9 extends GuessGame {
//    public int guessNumber(int n) {
//        int left = 1;
//        int right = n;
//        int mid = left + (right - left) / 2;
//        while (left <= right) {
//            mid = left + (right - left) / 2;
//            int temp = guess(mid);
//            if (temp == 0) {
//                break;
//            } else if (temp == -1) {
//                right = mid - 1;
//            } else {
//                left = mid + 1;
//            }
//        }
//        return mid;
//    }
//}